#ifndef CONTEXT_H_INCLUDED
#define CONTEXT_H_INCLUDED

#include <string>
#include <map>

#include "libxml/parser.h"

#include "sc/setup.h"

namespace sc {

/**
 * @class Context
 *
 */
class Context
{
public:
	Context(void);
	~Context(void);
private:
	Context(const Context& rcClass);
	Context& operator =(const Context& rcClass);

public:
    struct TMMI
    {
        std::string sValue;
        std::string sIcon;
    };

    typedef std::map<std::string, TMMI> TMapMMI;


protected:
    xmlDocPtr   m_sccDoc;
    Setup       m_setup;

    std::string m_sFilename;
    std::string m_sFileRNG;
    std::string m_sFileXML;

    TMapMMI     m_mapMMI;

public:
    int Load(const std::string& sFilenameSCC);
    int Save(void) const;
    int Save(const std::string& sFilenameSCC);

    void Clear(void);

    Setup& GetSetup(void) { return m_setup; }
    const Setup& GetSetup(void) const { return m_setup; }

    const TMapMMI& GetMMI(void) const { return m_mapMMI; }
    std::string GetLabel(const Setup::Element& rcElement) const;

    bool SetConfigFile(const std::string& sFileRNG);
    const std::string& GetConfigFile(void) const { return m_sFileRNG; }

protected:
    int LoadConfig(const xmlNodePtr pNodeRNG);
    int LoadSetup(const xmlNodePtr pNodeSetup);
    int LoadMMI(const xmlNodePtr pNodeMMI);

    int SaveConfig(xmlTextWriterPtr xmlWriter) const;
    int SaveSetup(xmlTextWriterPtr xmlWriter) const;
    int SaveMMI(xmlTextWriterPtr xmlWriter) const;
};

}; // namespace sc

#endif // CONTEXT_H_INCLUDED
